import React, { Component, useCallback, useState } from 'react';

export default class Exapmple extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      text: null,
    };
  }
  loaded() {
    clearTimeout(timer);
    this.setState({
      text: 'loading',
    });
    let timer = setTimeout(() => {
      this.setState({
        text: <button onClick={this.loaded.bind(this)}>loaded+</button>,
      });
    }, 3000);
  }
  componentDidMount() {
    this.setState({
      text: 'loading',
    });
    setTimeout(() => {
      this.setState({
        text: <button onClick={this.loaded.bind(this)}>loaded+</button>,
      });
    }, 3000);
  }
  render() {
    return <>{this.state.text}</>;
  }
}
